package com.hx.springboot1.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * Author: hx
 * Date: 2021-05-12 01/09
 * Description: Nothing else
 */
@Configuration
@EnableOpenApi
public class SwaggerConfig {
    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.hx.springboot1.controller"))  // 接口所在包
                .paths(PathSelectors.any())
                .build().apiInfo(new ApiInfoBuilder()  //  信息
                        .title("黄轩API文档")
                        .description("SpringBoot整合Swagger，详细信息......")
                        .version("版本号3.0.0")
                        .contact(new Contact("","https://user.qzone.qq.com/281227036/infocenter","281227036@qq.com"))
                        .license("The Apache License")
                        .licenseUrl("http://www.csdn.com")
                        .build());
    }

}
